/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core;

import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author Ahlberg
 */
public class Course extends SuperSchool
{
    private String courseId;
    private Collection<Book> books;

    /**
     * 
     */
    public Course()
    {
    }
    /**
     *
     * @param id
     * @param name
     * @param description
     * @param webLink
     * @param courseId
     */
    public Course(long id, String name,
            String description, String webLink, String courseId)
    {

        super(id, name, description, webLink);
        this.courseId = courseId;
        this.books = new ArrayList<Book>();
    }
    /**
     *
     * @param id
     * @param name
     * @param description
     * @param webLink
     * @param courseId
     * @param books
     */
    public Course(long id, String name,
            String description, String webLink, String courseId, Collection<Book> books)
    {

        super(id, name, description, webLink);
        this.courseId = courseId;
        this.books = books;
    }

    /**
     *
     * @return The collection of books to be returned.
     */
    public Collection<Book> getBooks(){
        return books;
    }
    /**
     *
     * @return The Course id.
     */
    public String getCourseId(){
        return courseId;
    }
    /**
     *
     * @param books
     */
    public void setBooks(Collection<Book> books){
        this.books = books;
    }
    /**
     *
     * @param courseId
     */
    public void setCourseId(String courseId){
        this.courseId = courseId;
    }
    /**
     *
     * @param book
     * @return
     */
    public boolean addBook(Book book){
        return books.add(book);
    }
    /**
     *
     * @param book
     * @return
     */
    public boolean removeBook(Book book)
    {
        return books.remove(book);
    }
    /**
     *
     * @param c
     * @return
     */
    public boolean equals(Course c)
    {
        return super.equals(c);
    }
    /**
     *
     * @return
     */
    @Override
    public String toString()
    {
        String str = super.toString();
        str +=  "courseId: " + courseId + "\n";
        str += "BOOKS:\n";
        for(Book b : books)
            if(b != null)
                str += b.toString();
        return str;
    }

}
